<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo">        	
	  <link rel="stylesheet" type="text/css" href="./estilos.css"/>
 
 <h:form id="formEditarMilestone" prependId="false"> 
 <h:panelGroup id="pgEditarMilestone">
	<p:commandButton value="Projeto" action="#{projetoBean.viewProjeto}" immediate="true" />
	<p:commandButton value="Atividade" action="#{atividadeBean.consultarAtividade}"/>
 	<p:commandButton value="Milestone" action="#{milestoneBean.consultarMilestone}"/>
 	<p:commandButton value="Membro" action="#{projetoBean.membroProjeto}"/>
 	<p:commandButton value="Log" action="#{projetoBean.consultarLog}"/> 
	<p:panel id="panelEditarMilestone" style="margin-bottom:20px">
	<f:facet name="header">
		<h:outputText value="Editar Milestone" styleClass="outputTextTitulo"/>
	</f:facet>
    	<p:growl id="growlEditarMilestone"/>  
        <h:panelGrid columns="6" style="margin-top:20px;">
			<p:outputLabel value="Código do Milestone:" styleClass="outputLabel"/>
			<p:inputText value="#{projetoBean.milestoneSave.idMilestone}" styleClass="inputId" style="text-align:left; float:left;" disabled="true"/> 
			<p:outputLabel value="Descrição:" styleClass="outputLabel" />
        	<p:inputText value="#{projetoBean.milestoneSave.descricao}" styleClass="inputDescricao" style="text-align:left; float:left;" 
        					required="true" requiredMessage="Informar o nome do Milestone!" disabled="#{projetoBean.disableGerente()}"/> 
      		<p:outputLabel value="Data:" style="font-size:14px;"/>
        	<p:inputMask value="#{projetoBean.milestoneSave.dtFinal}" mask="99/99/9999" styleClass="inputData" 
        					required="true" requiredMessage="Informar data!" disabled="#{projetoBean.disableGerente()}">
        		<f:convertDateTime dateStyle="medium"/>
        	</p:inputMask>
        </h:panelGrid>
        <h:panelGrid columns="2" style="margin-top:10px">
        	<p:commandButton value="Salvar" action="#{projetoBean.saveMilestone}" update="panelEditarMilestone" styleClass="commandButton" 
							rendered="#{projetoBean.renderedGerente()}"/>  
   			<p:commandButton value="Cancelar" action="#{projetoBean.consultarMilestone}" styleClass="commandButton" rendered="#{projetoBean.renderedGerente()}"/>	
		</h:panelGrid>
	</p:panel>  
		
		
	
    <p:dataTable  id="dataTableAtividadeMilestone" var="atividade" value="#{projetoBean.listaAtividadeMilestone}"  
    			 rowKey="#{atividade.idAtividade}" selectionMode="single" style="margin-bottom:10px; margin-top:10px; margin-right:15px; vertical-align:top; width:40%;">  
        <f:facet name="header">Atividades do Milestone</f:facet>    

        <p:column style="width:30%">  
            <f:facet name="header">  
                <h:outputText value="Nome da Atividade" />  
            </f:facet>  
            <h:outputText value="#{atividade.nomeAtividade}" />  
        </p:column>  
  
        <p:column style="width:10%">  
            <f:facet name="header">  
                <h:outputText value="Data de Conclusão" />  
            </f:facet>  
            <h:outputText value="#{atividade.dtFinal}" >
            	<f:convertDateTime dateStyle="medium"/>
            </h:outputText>  
        </p:column> 
        <p:column style="width:30%">  
            <f:facet name="header">  
                <h:outputText value="Responsável" />  
            </f:facet>  
            <h:outputText value="#{atividade.usuario.nome}" />  
        </p:column>  
        <p:column style="width:16%">  
            <f:facet name="header">  
                <h:outputText value="Status"  />  
            </f:facet>  
            <h:outputText value="#{atividade.status}" />  
        </p:column>   
        
        <p:column value="Excluir" style="width:4%; text-align:center" rendered="#{projetoBean.renderedGerente()}">  
        	<f:facet name="header">
        		<h:outputText value="Remover" />
        	</f:facet>
         	<p:commandButton id="selectButtonDelete" action="#{projetoBean.deleteAtividadeMilestone}" process="@this "  icon="ui-icon-circle-minus" title="Delete" >
         		<f:setPropertyActionListener value="#{atividade}" target="#{projetoBean.atividadeMilestone}" />  
         	</p:commandButton>
        </p:column>
    </p:dataTable> 

    <p:dataTable id="dataTableAtividade" var="atividade" value="#{projetoBean.listaAtividadeSemMilestone}"  
    			 rowKey="#{atividade.idAtividade}" selectionMode="single"
                 style="padding-top:20px; width:40%;">  
        <f:facet name="header">Atividades sem Milestone</f:facet>  
  
        <p:column style="width:30%">  
            <f:facet name="header">  
                <h:outputText value="Nome da Atividade" />  
            </f:facet>  
            <h:outputText value="#{atividade.nomeAtividade}" />  
        </p:column>  
        
 		<p:column style="width:10%">  
            <f:facet name="header">  
                <h:outputText value="Data de Conclusão" />  
            </f:facet>  
            <h:outputText value="#{atividade.dtFinal}" >
            	<f:convertDateTime dateStyle="medium"/>
            </h:outputText>  
        </p:column>
        <p:column style="width:30%">  
            <f:facet name="header">  
                <h:outputText value="Responsável" />  
            </f:facet>  
            <h:outputText value="#{atividade.usuario.nome}" />  
        </p:column>  
        <p:column style="width:16%">  
            <f:facet name="header">  
                <h:outputText value="Status" />  
            </f:facet>  
            <h:outputText value="#{atividade.status}" />  
        </p:column>   
        
        <p:column style="width:4%; text-align:center" rendered="#{projetoBean.renderedGerente()}">  
        	<f:facet name="header">
        	 <h:outputText value="Associar" />
        	</f:facet>
         	<p:commandButton id="selectButtonEditar" actionListener="#{projetoBean.associarAtividade}" process="@this " icon="ui-icon-circle-plus" title="Detail" >
         		<f:setPropertyActionListener value="#{atividade}" target="#{projetoBean.atividadeSemMilestone}" />
         	</p:commandButton> 
        </p:column> 
    </p:dataTable> 
</h:panelGroup>
</h:form>  	
</ui:define>
</ui:composition>
